Image coding and decoding methods and apparatuses

ABSTRACT

An embodiment of the present invention provides an image coding method, where the coding method includes: performing predictive coding on an image; performing transform coding on the image on which the predictive coding has been performed; performing, by using a quantization matrix, quantization coding on the image on which the transform coding has been performed, where the quantization matrix is a matrix reflecting image quantization step information, the quantization matrix includes an M*N quantization matrix and an N*M quantization matrix, and the N*M quantization matrix is obtained by transposing the M*N quantization matrix; and performing entropy coding on the image on which the quantization coding has been performed, and coding the M*N quantization matrix, so as to generate a code stream. In the present invention, the number of bits required for coding a quantization matrix is effectively saved, thereby improving compression efficiency.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2012/084062, filed on Nov. 5, 2012, which claims priority toChinese Patent Application No. 201110345953.8, filed on Nov. 4, 2011,both of which are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present invention relates to the field of communications, and inparticular, to image coding and decoding methods and apparatuses.

BACKGROUND

Because of a huge amount of video data, in an actual application, videodata usually needs to be compressed and coded. A coder processes thevideo data through prediction, transform, quantization, and entropycoding processes, so as to implement data compression to generate avideo stream. The video stream may be used for storage or networktransmission. A decoder performs a decoding operation on the videostream through entropy decoding, inverse quantization, inversetransform, and predictive compensation, so as to reconstruct the videodata.

In an H.264 coding technology, accurate control of a signal compressionartifact is implemented by using a quantization matrix (quantizationmatrix, QM). A coder provides a group of QMs suitable for acurrently-to-be-coded image according to content of the current image,and then writes code of the QMs into a code stream. After a decoderreceives the code stream carrying QM information, the decoder obtainsthe QM information through decoding, and obtains the image throughdecoding by using the QM information. In H.264, each frame of image mayhave a maximum of eight groups of QM matrices QMi, where i=1, 2, . . .8. The eight groups of QM matrices indicate six QMs in 4*4 transform:luminance Y, chrominance Cb, and chrominance Cr of intraframeprediction, and luminance Y, chrominance Cb, and chrominance Cr ofinterframe prediction, and two QMs in 8*8 transform: luminance Y ofintraframe prediction and interframe prediction. Because a data amountof the QM information is large, the QM information needs to becompressed and coded, so as to reduce the number of bits used forrepresenting the QM information. In H.264, six 4*4 quantization matricesand two 8*8 quantization matrices are separately coded by using thefollowing compression method. Specific steps are as follows:

First step: Perform a scanning operation on a two-dimensionalquantization matrix to generate one-dimensional data;

Second step: Perform DPCM coding on the one-dimensional data; and

Third step: Perform entropy coding on the coded data and write the dataon which the entropy coding has been performed into a code stream.

In the foregoing solution, both transform and quantization use N*Nsquare matrices, and when non-square transform and quantization matricesare used, for an N*M quantization matrix, many bits are required torepresent the quantization matrices according to the foregoingquantization matrix compression method; and when an applied bandwidth isquite small, bits used for transmitting the quantization matricesseverely affect the quality of a coded image.

SUMMARY

Embodiments of the present invention provide image coding and decodingmethods and apparatuses, so as to decrease a transmission bandwidth of acode stream.

An embodiment of the present invention provides an image coding method,where the coding method includes: performing predictive coding on animage; performing transform coding on the image on which the predictivecoding has been performed; performing, by using a quantization matrix,quantization coding on the image on which the transform coding has beenperformed, where the quantization matrix is a matrix reflecting imagequantization step information, the quantization matrix includes an M*Nquantization matrix and an N*M quantization matrix, and the N*Mquantization matrix is obtained by transposing the M*N quantizationmatrix; and performing entropy coding on the image on which thequantization coding has been performed, and coding the M*N quantizationmatrix, so as to generate a code stream.

An embodiment of the present invention provides an image decodingmethod, where the decoding method includes: performing entropy decodingon a received code stream to obtain image data and a quantizationmatrix, where the quantization matrix is a matrix reflecting imagequantization step information, and the quantization matrix includes anM*N quantization matrix; obtaining an N*M quantization matrix bytransposing the M*N quantization matrix; performing, by using the M*Nquantization matrix and the N*M quantization matrix, inversequantization on the image data; performing inverse transform on theimage data on which the inverse quantization has been performed; andperforming predictive compensation on the image data on which theinverse transform has been performed, so as to generate a decoded image.

An embodiment of the present invention provides an image codingapparatus, where the coding apparatus includes: a predictive codingmodule, configured to perform predictive coding on an image; a transformcoding module, configured to perform transform coding on the image onwhich the predictive coding has been performed; a quantization codingmodule, configured to perform, by using a quantization matrix,quantization coding on the image on which the transform coding has beenperformed, where the quantization matrix is a matrix reflecting imagequantization step information, the quantization matrix includes an M*Nquantization matrix and an N*M quantization matrix, and the N*Mquantization matrix is obtained by transposing the M*N quantizationmatrix; and an entropy coding module, configured to perform entropycoding on the image on which the quantization coding has been performed,and code the M*N quantization matrix, so as to generate a code stream.

An embodiment of the present invention provides an image decodingapparatus, where the decoding apparatus includes: an entropy decodingunit, configured to perform entropy decoding on a received code streamto obtain image data and a quantization matrix, where the quantizationmatrix is a matrix reflecting image quantization step information, andthe quantization matrix includes an M*N quantization matrix; an inversequantization unit, configured to obtain an N*M quantization matrix bytransposing the M*N quantization matrix, and perform, by using the M*Nquantization matrix and the N*M quantization matrix, inversequantization on the image data; an inverse transform unit, configured toperform inverse transform on the image data on which the inversequantization has been performed; and a predictive compensation unit,configured to perform predictive compensation on the image data on whichthe inverse transform has been performed, so as to generate a decodedimage.

In the embodiments of the present invention, the number of bits requiredfor coding a quantization matrix is effectively saved, thereby improvingcompression efficiency.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention or in the prior art more clearly, the accompanying drawingsrequired for describing the embodiments are introduced briefly in thefollowing. Apparently, the accompanying drawings in the followingdescription show some embodiments of the present invention, and a personof ordinary skill in the art can derive other drawings from theseaccompanying drawings without creative efforts.

FIG. 1 is a flowchart of an image coding method according to anembodiment of the present invention;

FIG. 2 is a flowchart of an image decoding method according to anembodiment of the present invention;

FIG. 3 is a flowchart of an image coding method according to anotherembodiment of the present invention;

FIG. 4 is a flowchart of an image decoding method according to anotherembodiment of the present invention;

FIG. 5 is a flowchart of an image coding method according to stillanother embodiment of the present invention;

FIG. 6 is a flowchart of an image decoding method according to stillanother embodiment of the present invention;

FIG. 7 is a structural diagram of an image coding apparatus according toan embodiment of the present invention; and

FIG. 8 is a structural diagram of an image decoding apparatus accordingto an embodiment of the present invention.

DETAILED DESCRIPTION

In order to make the objectives, technical solutions, and advantages ofthe present invention more comprehensible, the technical solutions inthe embodiments of the present invention are clearly described in thefollowing with reference to the accompanying drawings in the embodimentsof the present invention. Apparently, the embodiments to be describedare a part rather than all of the embodiments of the present invention.All other embodiments obtained by a person of ordinary skill in the artbased on the embodiments of the present invention without creativeefforts shall fall within the protection scope of the present invention.

An embodiment of the present invention provides an image coding method.Referring to FIG. 1, FIG. 1 is a flowchart of this method according toan embodiment. The coding method includes:

S101: Perform predictive coding on an image.

S103: Perform transform coding on the image on which the predictivecoding has been performed.

S105: Perform, by using a quantization matrix, quantization coding onthe image on which the transform coding has been performed, where thequantization matrix is a matrix reflecting image quantization stepinformation, the quantization matrix includes an M*N quantization matrixand an N*M quantization matrix, and the N*M quantization matrix isobtained by transposing the M*N quantization matrix.

S107: Perform entropy coding on the image on which the quantizationcoding has been performed, and code the M*N quantization matrix, so asto generate a code stream.

In an image coding and decoding process, each frame of image issegmented into small image blocks for coding or decoding processing, forexample, a frame of image is segmented into image blocks with a size ofN×N.

In an embodiment of the present invention, S101 specifically includes:when an N×N image block is coded, performing predictive coding on theN×N image according to a different subblock. For a flat image area, thearea is divided by using a large image subblock, so as to savedescription information used for describing an image divisionrelationship; for an image area with many details, the area is dividedby using a small image subblock, so as to improve predictive accuracyduring image coding; and compression efficiency is improved throughself-adaption division. According to different predictive relationships,predictive coding includes intraframe coding and interframe coding. Theintraframe coding is to predict a currently-to-be-coded block by using aspatially adjacent reconstructed pixel from a same frame of image. Theinterframe prediction is to predict a currently-to-be-coded block byusing a pixel of an image preceding or following an image where thecurrently-to-be-coded block is located.

In an embodiment of the present invention, S103 specifically includes:during the transform coding, performing the transform coding on data onwhich predictive coding has been performed, so as to concentrate dataenergy and reduce the number of bits used for describing the data.Transform coding technologies include DCT, DST, wavelet transform, andthe like. For a different subblock size, a different transform matrix isused to perform transform coding. By using DCT transform as an example,for a 4×4 subblock, 4×4 DCT transform is performed; for an 8×8 subblock,8×8 DCT transform is performed; and for a 32×32 subblock, 32×32 DCTtransform is performed, or 4×4 or 8×8 transform may be performed, ornon-square transform is performed, such as 32×8 transform or 16×4transform. Non-square transform has advantages of being capable ofbetter adapting to content of an image and improving coding efficiency.

In an embodiment of the present invention, S105 specifically includes:when a segment of video signals is coded, selecting, according todifferent image content, a transform matrix suitable for the imagecontent, performing, by using a quantization matrix, quantization codingon the image on which transform coding has been performed, and codingimage data information and the transform matrix and writing the codedimage data information and transform matrix into a code stream, so as tocontrol compression efficiency of video data. The quantization matrixincludes an M*N quantization matrix and an N*M quantization matrix, andthe N*M quantization matrix is obtained by transposing the M*Nquantization matrix.

Further, in another embodiment of the present invention, the N*Mquantization matrix is a transposed matrix of the M*N quantizationmatrix.

In an invention implementation solution with four coexistingquantization matrices: 8*8, 8*4, 4*8, and 4*4 quantization matrices,first a coder selects, according to image content, a quantization matrixQMi suitable for the current image content, where i=1, 2, . . . , 12,QM1 to QM6 are quantization matrices of components Y, Cb and Cr duringinterframe and intraframe predictive coding of a 4*4 transform matrix,QM7 to QM10 are quantization matrices of a component Y during interframeand intraframe predictive coding of an 8*4 transform matrix and a 4*8transform matrix, and QM11 to QM12 are quantization matrices of acomponent Y during interframe and intraframe predictive coding of an 8*8transform matrix. QM7 and QM9 are in a transposition relationship, andQM8 and QM10 are in a transposition relationship. Then, a transformedimage of the current image is quantized and coded by using thequantization matrices, and the quantized and coded image is written intoa code stream. Meanwhile, the quantization matrices are coded. When thequantization matrices are coded, only QM1 to 8 and QM11 to 12 are coded,and QM9 and 10 are not coded. Information of QM9 and 10 is obtainedafter a decoding end transposes information of QM7 and 8.

In another embodiment of the present invention, that the N*Mquantization matrix is obtained by transposing the M*N quantizationmatrix includes: calculating an N*M differential quantization matrixaccording to a difference between the N*M quantization matrix and atransposed matrix of the M*N quantization matrix; and the coding the M*Nquantization matrix includes: performing entropy coding on the image onwhich the quantization coding has been performed, the M*N quantizationmatrix, and the N*M differential quantization matrix.

In an embodiment of the present invention, S107 specifically includes:coding each quantization matrix according to the following method:

performing a scanning operation on a two-dimensional quantization matrixto generate one-dimensional data;

performing DPCM prediction on the one-dimensional data to generatepredicted differential data; and

performing entropy coding on the predicted differential data, andwriting the predicted differential data on which the entropy coding hasbeen performed into a code stream.

In another embodiment of the present invention, S107 specificallyincludes: coding each quantization matrix according to the followingmethod:

coding an M*N quantization matrix QM_(M×N) by using the followingmethod:

performing predictive coding on the current QM_(M×N), where a predictivesignal of the QM_(M×N) is a signal obtained by transposing the QM_(N×M),so as to obtain a predicated quantization matrix difference signalDQM_(M×N);

performing quantization processing and scanning on the DQM_(M×N) toobtain a one-dimensional coefficient; and

performing entropy coding on the one-dimensional coefficient, andwriting the one-dimensional coefficient on which the entropy coding hasbeen performed into a code stream.

An embodiment of the present invention provides an image decodingmethod. Referring to FIG. 2, FIG. 2 is a flowchart of this methodaccording to an embodiment. The decoding method includes:

S201: Perform entropy decoding on a received code stream to obtain imagedata and a quantization matrix, where the quantization matrix is amatrix reflecting image quantization step information, and thequantization matrix includes an M*N quantization matrix.

S203: Obtain an N*M quantization matrix by transposing the M*Nquantization matrix.

S205: Perform, by using the M*N quantization matrix and the N*Mquantization matrix, inverse quantization on the image data on which theentropy decoding has been performed.

S207: Perform inverse transform on the image data on which the inversequantization has been performed.

S209: Perform predictive compensation on the image data on which theinverse transform has been performed, so as to generate a decoded image.

In an embodiment of the present invention, a process of S201: performentropy decoding on a received code stream to obtain a quantizationmatrix includes:

performing entropy decoding on a code stream of the quantization matrixto obtain a one-dimensional predicted quantization coefficientdifference signal;

performing DPCM predictive compensation on the one-dimensionalquantization coefficient difference signal; and

performing inverse scanning to obtain a two-dimensional quantizationmatrix.

In another embodiment of the present invention, a process of S201:perform entropy decoding on a received code stream to obtain aquantization matrix includes:

performing entropy decoding on a code stream of a QM_(mxN) to obtain aone-dimensional coefficient;

performing inverse scanning on the one-dimensional coefficient to obtaina two-dimensional coefficient matrix;

performing inverse quantization on the two-dimensional coefficientmatrix to obtain a reconstructed value of a difference signal DQM_(M×N);and

using a transposition signal of a QM_(N×M) signal as a predictive value,where the QM_(N×M) signal is obtained through decoding, and performingpredictive compensation on a DQM_(M×N) by using the predictive value, soas to obtain a reconstructed QM_(M×N) signal and complete a decodingprocess of the QM_(M×N).

In an embodiment of the present invention, S203: obtain an N*Mquantization matrix by transposing the M*N quantization matrix, whichincludes that: the N*M quantization matrix is a transposed matrix of theM*N quantization matrix.

In another embodiment of the present invention, S201: perform entropydecoding on a received code stream to obtain image data and aquantization matrix, which includes: performing entropy decoding on thereceived code stream to obtain the image data, the quantization matrix,and an M*N differential quantization matrix; and S203: obtain an N*Mquantization matrix by transposing the M*N quantization matrix, whichincludes: obtaining the N*M quantization matrix by using a sum of atransposed matrix of the M*N quantization matrix and the N*Mdifferential quantization matrix.

In another embodiment of the present invention, if a coding endgenerates four quantization matrices: 8*8, 8*4, 4*8, and 4*4quantization matrices, a coder selects, according to image content, aquantization matrix QMi suitable for the current image content, wherei=1, 2, . . . , 12. When the quantization matrices are coded, only QM1to QM8 and QM11 to QM12 are coded. In S201, entropy decoding isperformed on the received code stream, and obtained quantizationmatrices include QM1 to QM8 and QM11 to QM12; and S203 includes:obtaining QM9 and QM10 by transposing decoded QM7 and QM8.

An embodiment of the present invention further provides an image codingmethod. Referring to FIG. 3, FIG. 3 is a flowchart of this methodaccording to an embodiment. This method includes:

S301: Perform predictive coding on an image.

S303: Perform transform coding on the image on which the predictivecoding has been performed.

S305: Perform, by using a quantization matrix, quantization coding onthe image on which the transform coding has been performed, where thequantization matrix is a matrix reflecting image quantization stepinformation, the quantization matrix includes an M*N quantization matrixand a P*Q quantization matrix, and the P*Q quantization matrix isobtained by scaling the M*N quantization matrix.

S307: Perform entropy coding on the image on which the quantizationcoding has been performed, and code the M*N quantization matrix, so asto generate a code stream.

In the embodiment of the present invention, M is not equal to N, and Pis not equal to Q.

In an embodiment of the present invention, in S305, the P*Q quantizationmatrix is obtained by scaling the M*N quantization matrix, whichincludes that: the P*Q quantization matrix is a scaled matrix of the M*Nquantization matrix.

In another embodiment of the present invention, in S305, the P*Qquantization matrix is obtained by scaling the M*N quantization matrix,which includes that: the P*Q quantization matrix is obtained bypredicting a scaled matrix of the M*N quantization matrix; and thecoding the M*N quantization matrix includes: obtaining a P*Qdifferential quantization matrix through calculation according to adifference between the P*Q quantization matrix and the scaled matrix ofthe M*N quantization matrix, and coding the M*N quantization matrix andthe P*Q differential quantization matrix.

If P is less than M or Q is less than N, the P*Q quantization matrix isobtained by performing downsampling interpolation or linearinterpolation on the scaled matrix of the M*N quantization matrix or byselecting a coefficient at a same interval from the matrix.

If P is greater than M or Q is greater than N, the P*Q quantizationmatrix is obtained by magnifying the M*N quantization matrix.

In an embodiment of the present invention, if a coding end generatesfour quantization matrices: 8*8, 8*4, 4*8, and 4*4 quantizationmatrices, the 8*4 and 4*8 quantization matrices may not be transmitted,and the 8*4 and 4*8 quantization matrices are derived from the 8*8quantization matrix.

The present invention provides an image decoding method. Referring toFIG. 4, FIG. 4 is a flowchart of this method according to an embodiment.The decoding method includes:

S401: Perform entropy decoding on a received code stream to obtain imagedata and a quantization matrix, where the quantization matrix is amatrix reflecting image quantization step information, and thequantization matrix includes an M*N quantization matrix.

S403: Obtain a P*Q quantization matrix by scaling the M*N quantizationmatrix.

S405: Perform, by using the M*N quantization matrix and the P*Qquantization matrix, inverse quantization on the image data on which theentropy decoding has been performed.

S407: Perform inverse transform on the image data on which the inversequantization has been performed.

S409: Perform predictive compensation on the image data on which theinverse transform has been performed, so as to generate a decoded image.

In an embodiment of the present invention, S403: obtain a P*Qquantization matrix by scaling the M*N quantization matrix, whichincludes that: the P*Q quantization matrix is a scaled matrix of the M*Nquantization matrix.

In the embodiment of the present invention, M is not equal to N, and Pis not equal to Q.

In another embodiment of the present invention, S401: perform entropydecoding on a received code stream to obtain image data and aquantization matrix, which includes: performing the entropy decoding onthe received code stream to obtain the image data, the quantizationmatrix, and an M*N differential quantization matrix; and S403: obtain aP*Q quantization matrix by scaling the M*N quantization matrix, whichincludes: obtaining the P*Q quantization matrix by using a sum of ascaled matrix of the M*N quantization matrix and the M*N differentialquantization matrix.

The present invention provides an image coding method. Referring to FIG.5, FIG. 5 is a flowchart of this method according to an embodiment. Thecoding method includes:

S501: Perform predictive coding on an image.

S503: Perform transform coding on the image on which the predictivecoding has been performed.

S505: Perform, by using a quantization matrix, quantization coding onthe image on which the transform coding has been performed, where thequantization matrix is a matrix reflecting image quantization stepinformation, the quantization matrix includes an M*N quantization matrixand a P*Q quantization matrix, and the P*Q quantization matrix isobtained by selecting the M*N quantization matrix.

S507: Perform entropy coding on the image on which the quantizationcoding has been performed, and code the M*N quantization matrix, so asto generate a code stream.

In the embodiment of the present invention, M is not equal to N, and Pis not equal to Q.

In an embodiment of the present invention, S505: the P*Q quantizationmatrix is obtained by selecting the M*N quantization matrix, whichincludes: the P*Q quantization matrix is a selected matrix of the M*Nquantization matrix.

In an embodiment of the present invention, S505: the P*Q quantizationmatrix is obtained by selecting the M*N quantization matrix, whichincludes: the P*Q quantization matrix is obtained by selecting andpredicting the M*N quantization matrix; and S507: code the M*Nquantization matrix, which includes: obtaining a P*Q differentialquantization matrix through calculation according to a differencebetween the P*Q quantization matrix and the selected matrix of the M*Nquantization matrix, and coding the M*N quantization matrix and the P*Qdifferential quantization matrix.

The present invention provides an image decoding method. Referring toFIG. 6, FIG. 6 is a flowchart of this method according to an embodiment.The decoding method includes:

S601: Perform entropy decoding on a received code stream to obtain imagedata and a quantization matrix, where the quantization matrix is amatrix reflecting image quantization step information, and thequantization matrix includes an M*N quantization matrix.

S603: Obtain a P*Q quantization matrix by selecting the M*N quantizationmatrix.

S605: Perform, by using the M*N quantization matrix and the P*Qquantization matrix, inverse quantization on the image data on which theentropy decoding has been performed.

S607: Perform inverse transform on the image data on which the inversequantization has been performed.

S609: Perform predictive compensation on the image data on which theinverse transform has been performed, so as to generate a decoded image.

In the embodiment of the present invention, M is not equal to N, and Pis not equal to Q.

In an embodiment of the present invention, S603: obtain a P*Qquantization matrix by selecting the M*N quantization matrix, whichincludes that: the P*Q quantization matrix is a selected matrix of theM*N quantization matrix.

In another embodiment of the present invention, S601: perform entropydecoding on a received code stream to obtain image data and aquantization matrix, which includes: performing the entropy decoding onthe received code stream to obtain the image data, the quantizationmatrix, and an M*N differential quantization matrix; and S603: obtain aP*Q quantization matrix by selecting the M*N quantization matrix, whichincludes: obtaining the P*Q quantization matrix by using a sum of aselected matrix of the M*N quantization matrix and the M*N differentialquantization matrix.

An embodiment of the present invention provides an image codingapparatus. Referring to FIG. 7, FIG. 7 is a structural diagram of thisapparatus according to an embodiment. The image coding apparatusincludes: a predictive coding module 701, configured to performpredictive coding on an image; a transform coding module 703, configuredto perform transform coding on the image on which the predictive codinghas been performed; a quantization coding module 705, configured toperform, by using a quantization matrix, quantization coding on theimage on which the transform coding has been performed, where thequantization matrix is a matrix reflecting image quantization stepinformation, the quantization matrix includes an M*N quantization matrixand an N*M quantization matrix, and the N*M quantization matrix isobtained by transposing the M*N quantization matrix; and an entropycoding module 707, configured to perform entropy coding on the image onwhich the quantization coding has been performed, and code the M*Nquantization matrix, so as to generate a code stream.

The quantization coding module 703 is configured to perform, by usingthe quantization matrix including the M*N quantization matrix and theN*M quantization matrix, the quantization coding on the image on whichthe transform coding has been performed, where the N*M quantizationmatrix is obtained by transposing the M*N quantization matrix.

The quantization coding module 703 is configured to perform, by usingthe quantization matrix including the M*N quantization matrix and theN*M quantization matrix, the quantization coding on the image on whichthe transform coding has been performed, where the N*M quantizationmatrix is obtained by transposing and predicting the M*N quantizationmatrix; and the entropy coding module 707 is configured to obtain an N*Mdifferential quantization matrix through calculation according to adifference between the N*M quantization matrix and a transposed matrixof the M*N quantization matrix, and code the M*N quantization matrix andthe N*M differential quantization matrix.

An embodiment of the present invention provides an image decodingapparatus. Referring to FIG. 8, FIG. 8 is a structural diagram of thisapparatus according to an embodiment. The image decoding apparatusincludes: an entropy decoding unit 801, configured to perform entropydecoding on a received code stream to obtain image data and aquantization matrix, where the quantization matrix is a matrixreflecting image quantization step information, and the quantizationmatrix includes an M*N quantization matrix; an inverse quantization unit803, configured to obtain an N*M quantization matrix by transposing theM*N quantization matrix, and perform, by using the M*N quantizationmatrix and the N*M quantization matrix, inverse quantization on theimage data on which the entropy decoding has been performed; an inversetransform unit 805, configured to perform inverse transform on the imagedata on which the inverse quantization has been performed; and apredictive compensation unit 807, configured to perform predictivecompensation on the image data on which the inverse transform has beenperformed, so as to generate a decoded image.

The inverse quantization unit 803 is configured to assign a transposedmatrix of the M*N quantization matrix to the N*M quantization matrix.

The entropy decoding unit 801 is configured to perform the entropydecoding on the received code stream to obtain the image data, thequantization matrix, and an M*N differential quantization matrix; andthe inverse quantization unit is configured to obtain the N*Mquantization matrix by using a sum of the transposed matrix of the M*Nquantization matrix and the N*M differential quantization matrix.

An embodiment of the present invention provides an image codingapparatus, where the apparatus includes: a predictive coding module,configured to perform predictive coding on an image; a transform codingmodule, configured to perform transform coding on the image on which thepredictive coding has been performed; a quantization coding module,configured to perform, by using a quantization matrix, quantizationcoding on the image on which the transform coding has been performed,where the quantization matrix is a matrix reflecting image quantizationstep information, the quantization matrix includes an M*N quantizationmatrix and a P*Q quantization matrix, and the P*Q quantization matrix isobtained by scaling the M*N quantization matrix; and an entropy codingmodule, configured to perform entropy coding on the image on which thequantization coding has been performed, and code the M*N quantizationmatrix, so as to generate a code stream.

The quantization coding module is configured to perform, by using thequantization matrix including the M*N quantization matrix and the P*Qquantization matrix, the quantization coding on the image on which thetransform coding has been performed, where the P*Q quantization matrixis a scaled matrix of the M*N quantization matrix.

The quantization coding module is configured to perform, by using thequantization matrix including the M*N quantization matrix and the P*Qquantization matrix, the quantization coding on the image on which thetransform coding has been performed, where the P*Q quantization matrixis obtained by predicting the scaled matrix of the M*N quantizationmatrix; and the entropy coding module is configured to obtain a P*Qdifferential quantization matrix through calculation according to adifference between the P*Q quantization matrix and the scaled matrix ofthe M*N quantization matrix, and code the M*N quantization matrix andthe P*Q differential quantization matrix.

An embodiment of the present invention provides an image decodingapparatus, where the decoding apparatus includes: an entropy decodingunit, configured to perform entropy decoding on a received code streamto obtain image data and a quantization matrix, where the quantizationmatrix is a matrix reflecting image quantization step information, andthe quantization matrix includes an M*N quantization matrix; an inversequantization unit, configured to obtain a P*Q quantization matrix byscaling the M*N quantization matrix, and perform, by using the M*Nquantization matrix and the P*Q quantization matrix, inversequantization on the image data on which the entropy decoding has beenperformed; an inverse transform unit, configured to perform inversetransform on the image data on which the inverse quantization has beenperformed; and a predictive compensation unit, configured to performpredictive compensation on the image data on which the inverse transformhas been performed, so as to generate a decoded image.

The inverse quantization unit is configured to assign a scaled matrix ofthe M*N quantization matrix to the P*Q quantization matrix.

The entropy decoding unit is configured to perform the entropy decodingon the received code stream to obtain the image data, the quantizationmatrix, and an M*N differential quantization matrix; and the inversequantization unit is configured to obtain the P*Q quantization matrix byusing a sum of the scaled matrix of the M*N quantization matrix and theM*N differential quantization matrix.

An embodiment of the present invention provides an image codingapparatus, where the coding apparatus includes: a predictive codingmodule, configured to perform predictive coding on an image; a transformcoding module, configured to perform transform coding on the image onwhich the predictive coding has been performed; a quantization codingmodule, configured to perform, by using a quantization matrix,quantization coding on the image on which the transform coding has beenperformed, where the quantization matrix is a matrix reflecting imagequantization step information, the quantization matrix includes an M*Nquantization matrix and a P*Q quantization matrix, and the P*Qquantization matrix is obtained by selecting the M*N quantizationmatrix; and an entropy coding module, configured to perform entropycoding on the image on which the quantization coding has been performed,and code the M*N quantization matrix, so as to generate a code stream.

The quantization coding module is configured to perform, by using thequantization matrix including the M*N quantization matrix and the P*Qquantization matrix, the quantization coding on the image on which thetransform coding has been performed, where the P*Q quantization matrixis a selected matrix of the M*N quantization matrix.

The quantization coding module is configured to perform, by using thequantization matrix including the M*N quantization matrix and the P*Qquantization matrix, the quantization coding on the image on which thetransform coding has been performed, where the P*Q quantization matrixis obtained by selecting and predicting the M*N quantization matrix; andthe entropy coding module is configured to obtain a P*Q differentialquantization matrix through calculation according to a differencebetween the P*Q quantization matrix and the selected matrix of the M*Nquantization matrix, and code the M*N quantization matrix and the P*Qdifferential quantization matrix.

An embodiment of the present invention provides an image decodingapparatus, where the decoding apparatus includes: an entropy decodingunit, configured to perform entropy decoding on a received code streamto obtain image data and a quantization matrix, where the quantizationmatrix is a matrix reflecting image quantization step information, andthe quantization matrix includes an M*N quantization matrix; an inversequantization unit, configured to obtain a P*Q quantization matrix byselecting the M*N quantization matrix, and perform, by using the M*Nquantization matrix and the P*Q quantization matrix, inversequantization on the image data on which the entropy decoding has beenperformed; an inverse transform unit, configured to perform inversetransform on the image data on which the inverse quantization has beenperformed; and a predictive compensation unit, configured to performpredictive compensation on the image data on which the inverse transformhas been performed, so as to generate a decoded image.

The inverse quantization unit is configured to assign a selected matrixof the M*N quantization matrix to the P*Q quantization matrix.

The entropy decoding unit is configured to perform entropy decoding onthe received code stream to obtain the image data, the quantizationmatrix, and an M*N differential quantization matrix; and the obtaining aP*Q quantization matrix by selecting the M*N quantization matrixincludes that: the inverse quantization unit is configured to obtain theP*Q quantization matrix by using a sum of the selected matrix of the M*Nquantization matrix and the M*N differential quantization matrix.

Finally, it should be noted that the foregoing embodiments are merelyprovided for describing the technical solutions of the presentinvention, but are not intended to limit the present invention. Itshould be understood by a person of ordinary skill in the art thatalthough the present invention has been described in detail withreference to the foregoing embodiments, modifications can still be madeto the technical solutions described in the foregoing embodiments, orequivalent replacements can be made to some technical features in thetechnical solutions, as long as such modifications or replacements donot make the essence of corresponding technical solutions depart fromthe spirit and scope of the technical solutions in the embodiments ofthe present invention.

What is claimed is:
 1. An image decoding apparatus, wherein the imagedecoding apparatus is configured to: perform entropy decoding on areceived code stream to obtain image data and a quantization matrix,wherein the quantization matrix is a matrix reflecting imagequantization step information, and the quantization matrix comprises anM*N quantization matrix; obtain a P*Q quantization matrix by scaling theM*N quantization matrix and by using a sum of a scaled matrix of the M*Nquantization matrix and an M*N differential quantization matrix, andperform, by using the M*N quantization matrix and the P*Q quantizationmatrix, inverse quantization on the image data on which the entropydecoding has been performed; perform inverse transform on the image dataon which the inverse quantization has been performed; and performpredictive compensation on the image data on which the inverse transformhas been performed, so as to generate a decoded image.
 2. The decodingapparatus according to claim 1, further configured to assign the scaledmatrix of the M*N quantization matrix to the P*Q quantization matrix. 3.The decoding apparatus according to claim 1, further configured to:perform the entropy decoding on the received code stream to obtain theimage data, the quantization matrix, and the M*N differentialquantization matrix.
 4. An image decoding apparatus, wherein the imagedecoding apparatus is configured to: perform entropy decoding on areceived code stream to obtain image data and a quantization matrix,wherein the quantization matrix is a matrix reflecting imagequantization step information, and the quantization matrix comprises anM*N quantization matrix; obtain a P*Q quantization matrix by selectingthe M*N quantization matrix and by using a sum of a scaled matrix of theM*N quantization matrix and an M*N differential quantization matrix, andperform, by using the M*N quantization matrix and the P*Q quantizationmatrix, inverse quantization on the image data on which the entropydecoding has been performed; perform inverse transform on the image dataon which the inverse quantization has been performed; and performpredictive compensation on the image data on which the inverse transformhas been performed, so as to generate a decoded image.
 5. The decodingapparatus according to claim 4, further configured to assign theselected matrix of the M*N quantization matrix to the P*Q quantizationmatrix.
 6. The decoding apparatus according to claim 4, furtherconfigured to perform the entropy decoding on the received code streamto obtain the image data, the quantization matrix, and the M*Ndifferential quantization matrix.
 7. An image decoding method performedby an image decoding apparatus, comprising: performing entropy decodingon a received code stream to obtain image data and a quantizationmatrix, wherein the quantization matrix is a matrix reflecting imagequantization step information, and the quantization matrix comprises anM*N quantization matrix; obtaining a P*Q quantization matrix by scalingthe M*N quantization matrix and by using a sum of a scaled matrix of theM*N quantization matrix and an M*N differential quantization matrix, andperforming, by using the M*N quantization matrix and the P*Qquantization matrix, inverse quantization on the image data on which theentropy decoding has been performed; performing inverse transform on theimage data on which the inverse quantization has been performed; andperforming predictive compensation on the image data on which theinverse transform has been performed, so as to generate a decoded image.8. The image decoding method according to claim 7, further comprisingassigning the scaled matrix of the M*N quantization matrix to the P*Qquantization matrix.
 9. The image decoding method according to claim 7,further comprising: performing the entropy decoding on the received codestream to obtain the image data, the quantization matrix, and the M*Ndifferential quantization matrix.
 10. An image decoding method performedby an image decoding apparatus, comprising: performing entropy decodingon a received code stream to obtain image data and a quantizationmatrix, wherein the quantization matrix is a matrix reflecting imagequantization step information, and the quantization matrix comprises anM*N quantization matrix; obtaining a P*Q quantization matrix byselecting the M*N quantization matrix and by using a sum of a scaledmatrix of the M*N quantization matrix and an M*N differentialquantization matrix, and performing, by using the M*N quantizationmatrix and the P*Q quantization matrix, inverse quantization on theimage data on which the entropy decoding has been performed; performinginverse transform on the image data on which the inverse quantizationhas been performed; and performing predictive compensation on the imagedata on which the inverse transform has been performed, so as togenerate a decoded image.
 11. The image decoding method according toclaim 10, further configured to assign the selected matrix of the M*Nquantization matrix to the P*Q quantization matrix.
 12. The imagedecoding method according to claim 10, further comprising performing theentropy decoding on the received code stream to obtain the image data,the quantization matrix, and the M*N differential quantization matrix.